package com.easy_buy.domain;

import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import java.util.Date;

@Entity
@Data
public class User implements Role {

    @NotBlank(message = "不能为空")
    @Id
    private String ucode;
    private String upassword;
    @NotBlank(message = "必须输入姓名")
    private String uname;
    private String sex;
    private String sfznum;     // 身份证正则表达式
    private String phone;      // 电话
    private Date logintime;    // 最近登录时间

    @Override
    public String getRole() {
        return "顾客";
    }

    @Override
    public String getCode() {
        return this.ucode;
    }

    @Override
    public String getPassword() {
        return this.upassword;
    }

    @Override
    public String getName() {
        return this.uname;
    }
}
